package query

import (
	"ssforward/common/dto"
)

type ForwardServerQuery struct {
	dto.Pagination `search:"-"`
	dto.OrderBy    `search:"-"`
	dto.UserInfo
	Id   string `form:"id" json:"id" search:"type:exact;column:id;table:sys_forward_server"`
	Name string `form:"name" search:"type:contains;column:name;table:sys_forward_server"`
	Host string `form:"host" search:"type:contains;column:host;table:sys_forward_server"`
	Type string `form:"type" search:"type:exact;column:type;table:sys_forward_server"`

	AgencyIdEq string   `search:"type:exact;column:agency_id;table:sys_forward_server"`
	IdIn       []string `search:"type:in;column:id;table:sys_forward_server"`
}

func (m *ForwardServerQuery) GetNeedSearch() interface{} {
	if m.UserId != "1" {
		m.AgencyIdEq = m.AgencyId
	}
	return *m
}
